<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE HTML>
<html>
<head>
  <title>后台管理系统</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link href="/resources/css/dpl-min.css" rel="stylesheet" type="text/css" />
  <link href="/resources/css/bui-min.css" rel="stylesheet" type="text/css" />
  <link href="/resources/css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="header">
  <div class="dl-title"><span class="">后台管理系统</span></div>
  <div class="dl-log">欢迎您，<span class="dl-log-user">${ADMIN.loginName}</span>&nbsp;
    <a href="javascript:void(0);" title="修改密码" class="dl-log-quit" onclick="updatePwd()">修改密码</a>&nbsp;
    <a href="/logout" title="退出系统" class="dl-log-quit">[退出]</a>
  </div>
</div>
<div class="content">
  <div class="dl-main-nav">
    <ul id="J_Nav"  class="nav-list ks-clear">
      <li class="nav-item dl-selected"><div class="nav-item-inner nav-home">平台管理</div></li>
      <li class="nav-item"><div class="nav-item-inner nav-inventory">用户管理</div></li>
      <li class="nav-item"><div class="nav-item-inner nav-storage">优惠信息管理</div></li>
      <li class="nav-item"><div class="nav-item-inner nav-storage">抓取设置</div></li>
      <li class="nav-item"><div class="nav-item-inner nav-user">数据统计</div></li>
      <li class="nav-item"><div class="nav-item-inner nav-certification">系统设置</div></li>
    </ul>
  </div>
  <ul id="J_NavContent" class="dl-tab-conten">

  </ul>

</div>
<input type="hidden" id="isInMainStatus" value="1">
<script type="text/javascript" src="/resources/js/sea.js"></script>
<script type="text/javascript" src="/resources/js/jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="/resources/js/bui-min.js"></script>
<script type="text/javascript" src="/resources/js/config-min.js"></script>
<script>
  BUI.use('common/main',function(){
    var config = [{
      id:'member',
      homePage:"main_menu",
      menu:[{
        text:'平台数据',
        items:[
          <shiro:hasPermission name="data:list">
          {id:'main_menu',text:'数据统计',href:'/welcome'}
         </shiro:hasPermission>
          <%--<shiro:hasPermission name="main_menu">
          {id:'jy',text:'结&nbsp;&nbsp;&nbsp;&nbsp;余',href:'/orderFx/view'}
          </shiro:hasPermission>--%>
        ]
      }]
    },{
      id:'user',
      homePage:"user_list",
      menu:[{
        text:'用户管理',
        items:[
          <shiro:hasPermission name="user:list">
            {id:'user_list',text:'用户列表',href:'/user/list'}
                </shiro:hasPermission>

        ]
      }]
    },{
      id:'info',
      homePage:"info_list",
      menu:[{
        text:'优惠信息管理',
        items:[
          <shiro:hasPermission name="info:list">
          {id:'info_list',text:'优惠信息管理',href:'/product/list'}
          </shiro:hasPermission>
        ]
      }]
    },{
      id:'zhuaqu',
      homePage:"rule_list",
      menu:[{
        text:'抓取设置',
        items:[
          <shiro:hasPermission name="rule:list">
          {id:'rule_list',text:'抓取规则列表',href:'/txApply/list'},
                </shiro:hasPermission>
          <shiro:hasPermission name="rule:log:list">
          {id:'rule_log_list',text:'抓取日志',href:'/memberAmount/list'}
                </shiro:hasPermission>
        ]
      }]
    },{
      id:'tongji',
      homePage:"browse_cnt",
      menu:[{
        text:'数据统计',
        items:[
          <shiro:hasPermission name="browse:cnt">
          {id:'browse_cnt',text:'页面访问量统计',href:'/notice/list',closeable:true},
                </shiro:hasPermission>
          <shiro:hasPermission name="browse:detail">
          {id:'browse_detail',text:'页面访问量明细',href:'/params/view',closeable:true},
                </shiro:hasPermission>
          <shiro:hasPermission name="activity:cnt">
          {id:'activity_cnt',text:'活动数据统计',href:'/params/wxView',closeable:true},
                </shiro:hasPermission>
          <shiro:hasPermission name="activity:detail">
          {id:'activity_detail',text:'活动数据明细',href:'/dictionary/list',closeable:true}
          </shiro:hasPermission>
        ]
      }]
    },{
      id:'system',
      homePage:"admin_list",
      menu:[{
        text:'系统管理',
        items:[
          <shiro:hasPermission name="admin:list">
          {id:'admin_list',text:'管理员管理',href:'/admin/list',closeable:true},
          </shiro:hasPermission>
          <shiro:hasPermission name="role:list">
          {id:'role_list',text:'角色管理',href:'/role/list',closeable:true},
          </shiro:hasPermission>
          <shiro:hasPermission name="permission:list">
          {id:'permission_list',text:'权限管理',href:'/permission/list',closeable:true},
                </shiro:hasPermission>
          <shiro:hasPermission name="log:list">
          {id:'log_list',text:'日志管理',href:'/log/list',closeable:true}
          </shiro:hasPermission>
        ]
      }]
    }];
    new PageUtil.MainPage({
      modulesConfig : config
    });
  });


  function updatePwd(){
    top.topManager.openPage({
      id:"update_pwd",
      href:"/admin/beforeUpdatePwd?ran="+Math.random(),
      title:"修改密码"
    });

  }

  $(function(){
    //setInterval(checkNewOrder,60000);
  });


  function checkNewOrder(){
    $.ajax({
      url:"/wx/checkNewOrder?r="+Math.random(),
      type:"post",
      dataType:"json",
      success:function(res){
        if(res.success)
          playSound();
      },
      error:function(){}
    })
  }

  function playSound()
  {
    var borswer = window.navigator.userAgent.toLowerCase();
    if ( borswer.indexOf( "ie" ) >= 0 )
    {
      //IE内核浏览器
      var strEmbed = '<embed name="embedPlay" src="/resources/ordervideo.mp3" autostart="true" hidden="true" loop="false"></embed>';
      if ( $( "body" ).find( "embed" ).length <= 0 )
        $( "body" ).append( strEmbed );
      var embed = document.embedPlay;

      //浏览器不支持 audion，则使用 embed 播放
      embed.volume = 100;
      embed.play();
    } else
    {
      //非IE内核浏览器
      var strAudio = "<audio id='audioPlay' src='/resources/ordervideo.mp3' hidden='true'>";
      if ( $( "body" ).find( "audio" ).length <= 0 )
        $( "body" ).append( strAudio );
      var audio = document.getElementById( "audioPlay" );

      //浏览器支持 audion
      audio.play();
    }
    soundFlag = false;
  }



</script>
</body>
</html>